
//https://leetcode.cn/problems/reverse-bits/submissions/
uint32_t reverseBits(uint32_t n) {
    uint32_t tmp = 0;
    int i = 31;
    while (i > 0)
    {
        if (n & 1 == 1)
        {
            tmp = (tmp + 1) << 1;
        }
        else
        {
            tmp = tmp << 1;
        }
        n = n >> 1;
        --i;
    }
    if (n & 1 == 1)
    {
        tmp = tmp + 1;
    }
    return tmp;
}